#include "image.h"

void setImageHeight(Image *image, int imageHeight) {
	image->height = imageHeight;
}
int getImageHeight(Image *image) {
	return image->height;
}

void setImageWidth(Image *image, int imageWidth) {
	image->width = imageWidth;
}

int getImageWidth(Image *image) {
	return image->width;
}

void setImageMatrix(Image *image, pixel **Matrix) { // 2D image
	image->Matrix = Matrix;
}

pixel** getImageMatrix(Image *image) {
	return image->Matrix;
}

void setImageALL(Image *image, int imageHeight, int imageWidth, pixel **Matrix) {
	image->height = imageHeight;
	image->width = imageWidth;
	image->Matrix = Matrix;
}

Image* buildImageMatrix(int height, int width) {
	Image *image;
	pixel **Matrix;
	int i, j;

	Matrix = (pixel**)malloc(height * sizeof(pixel*));
	for (i = 0; i < height; i++) {
		Matrix[i] = (pixel*)malloc(width * sizeof(pixel));
	}

	for (i = 0; i < height; i++) {
		for (j = 0; j < width; j++) {
			Matrix[i][j] = 255;
		}
	}

	image = (Image*)malloc(sizeof(struct structImage));
	image->Matrix = Matrix;
	image->height = height;
	image->width = width;

	return image;
}
